package uk.ac.manchester.tewpl.iceiface.client.service;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

import uk.ac.manchester.tewpl.iceiface.client.ExploriumClientException;
import uk.ac.manchester.tewpl.iceiface.client.model.KBClassModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBCommunityModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBDatatypePropertyModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBDatatypePropertyValueModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBIndividualModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBInfoModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBObjectPropertyModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBObjectPropertyValueModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBResourceModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBWorkspaceModel;
import uk.ac.manchester.tewpl.iceiface.client.tree.Tree;

import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.google.gwt.user.client.rpc.AsyncCallback;

public interface KBServiceAsync {
	void findWorkspacesByCommunity(KBCommunityModel community,
			AsyncCallback<Collection<KBWorkspaceModel>> callback);

	void createKnowledgeBase(String uri, String name, String description,
			AsyncCallback<KBInfoModel> callback);

	void saveKBInfo(KBInfoModel kb, AsyncCallback<KBInfoModel> callback);

	void deleteKnowledgeBaseByUri(String uri, AsyncCallback<Void> callback);

	void saveClass(KBClassModel cls, AsyncCallback<KBClassModel> callback);

	void findClassHierarchy(KBWorkspaceModel ws,
			AsyncCallback<Tree<KBClassModel>> callback);

	void deleteClass(KBClassModel cls, AsyncCallback<Void> callback);

	void findIndividuals(KBClassModel cls, KBWorkspaceModel ws,
			AsyncCallback<Collection<KBIndividualModel>> callback);
	
	void findIndividualsWithFilter(String filter, KBClassModel cls, KBWorkspaceModel ws,
			AsyncCallback<Collection<KBIndividualModel>> callback);

	void findIndividualsPaged(PagingLoadConfig config, KBClassModel cls,
			KBWorkspaceModel ws,
			AsyncCallback<PagingLoadResult<KBIndividualModel>> callback);

	void deleteIndividual(String workspaceUri, KBIndividualModel individual,
			AsyncCallback<Void> callback);
	
	void purgeCachedKnowledgeBase(KBInfoModel kb,
			AsyncCallback<Void> callback);

	void saveIndividual(String workspaceUri, KBIndividualModel individual,
			AsyncCallback<KBIndividualModel> callback);

	void findAllKnowledgeBases(
			AsyncCallback<BasePagingLoadResult<KBInfoModel>> callback);

	void findDatatypePropertiesForIndividual(String workspaceUri, KBIndividualModel individual,
			AsyncCallback<Collection<KBDatatypePropertyModel>> callback);

	void findAllDataPropertyValues(String workspaceUri, 
			KBIndividualModel individual,
			AsyncCallback<Collection<KBDatatypePropertyValueModel>> callback);

	void findAllObjectPropertyValues(String workspaceUri, KBIndividualModel individual,
			AsyncCallback<Collection<KBObjectPropertyValueModel>> callback);

	void findObjectPropertiesForIndividual(String workspaceUri, KBIndividualModel individual,
			AsyncCallback<Collection<KBObjectPropertyModel>> callback);
	
	void findSubClasses(KBClassModel cls, KBWorkspaceModel ws, AsyncCallback<Collection<KBClassModel>> callback);
	
	void findSuperClasses(KBClassModel cls, KBWorkspaceModel ws, AsyncCallback<Collection<KBClassModel>> callback);
	
	void saveDatatypePropertyValue (String workspaceUri, KBDatatypePropertyValueModel dpvm, KBDatatypePropertyModel kdp, KBIndividualModel ind, AsyncCallback<KBDatatypePropertyValueModel> callback);
	
	void saveObjectPropertyValue (String workspaceUri, KBIndividualModel value, KBObjectPropertyModel property, KBIndividualModel ind, AsyncCallback<KBObjectPropertyValueModel> callback);
	
	void findDatatypePropertiesForClass (KBClassModel cls, AsyncCallback<Collection<KBDatatypePropertyModel>> callback);
	
	void findObjectPropertiesForClass (KBClassModel cls, AsyncCallback<Collection<KBObjectPropertyModel>> callback);
	
	void findClassesFromCSV(String kbURI, String ws, String csv, AsyncCallback<Collection<KBClassModel>> callback);
	
	void findRelatedIndividualsOfClass(String workspaceUri, KBIndividualModel ind, KBClassModel cls, AsyncCallback<Collection<KBIndividualModel>> callback);
	
	void findRootClasses(KBWorkspaceModel ws, AsyncCallback<Collection<KBClassModel>> callback);

	void findClass(String classUri, KBWorkspaceModel ws, AsyncCallback<KBClassModel> callback);
	
	void executeQuery(String query, KBWorkspaceModel ws, AsyncCallback<Collection<Map<String, KBIndividualModel>>> callback);
	
	void findIndividualObjectPropertyValues(String individualUri, KBWorkspaceModel ws, AsyncCallback<Map<KBObjectPropertyModel, Collection<KBIndividualModel>>> callback);
	
	void findIndividual(String individualUri, KBWorkspaceModel ws, AsyncCallback<KBIndividualModel> callback);
}
